package com.xiaomi.domain;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
import java.util.Set;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class CategoryEntity implements Serializable {
    private int cid;
    private String cname;
    private Integer state;
    private int orderNumber;
    private String description;
    private Date createTime;
    public CategoryEntity(String cid,String cname,String state,String orderNumber,String description,String createTime) throws ParseException {
        if(cid==null){
            this.cid=0;
        }else {
            this.cid=Integer.parseInt(cid);
        }
        this.cname=cname;
        this.state=Integer.parseInt(state);
        this.orderNumber=Integer.parseInt(orderNumber);
        this.description=description;
        SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        this.createTime=new Date(format.parse(createTime).getTime());
        //时间转换为字符串
        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        java.util.Date date=new java.util.Date();
        String str=sdf.format(this.createTime);



    }

}
